﻿

namespace SLG_Demo_0
{
	public class MapData
	{
        /// <summary>
        /// 所属地图对象
        /// </summary>
        public MapObject MapObject { get; private set; }

        /// <summary>
        /// 地图数据层
        /// </summary>
        public CellData[,] Cells { get; set; }

        /// <summary>
        /// 地图宽高
        /// </summary>
        public int _width = 0, _height = 0;

        /// <summary>
        /// 地图格子总数
        /// </summary>
        public int CellNum { get { return _width * _height; } }

        ////////////////////////////////////////////////////////////
        public void Create(MapObject pMapObj, int nWidth, int nHeight)
		{
			MapObject = pMapObj;
			_width = nWidth;
			_height = nHeight;

            Cells = new CellData[_width, _height];
			for (int iRow = 0; iRow < _height; ++iRow)
			{
				for (int iCol = 0; iCol < _width; ++iCol)
				{
                    Cells[iCol, iRow] = new CellData(pMapObj, iCol, iRow); ;
				}
			}
		}
	}
}
